//
//  Logger.h
//  FreeMessage
//
//  Created by Fox Guo on 12-7-10.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Logger.h"

#define THIS_FILE (ExtractFileNameWithoutExtension(__FILE__, NO))
#define THIS_METHOD NSStringFromSelector(_cmd)




/*****************************************************************************/
/* Entry/exit trace macros                                                   */
/*****************************************************************************/
/*
#if TRC_LEVEL == 0
#define TRC_ENTRY    NSLog(@"ENTRY: %s:%d:", __PRETTY_FUNCTION__,__LINE__);
#define TRC_EXIT     NSLog(@"EXIT:  %s:%d:", __PRETTY_FUNCTION__,__LINE__);
#else
#define TRC_ENTRY
#define TRC_EXIT
#endif
*/
/*****************************************************************************/
/* Debug trace macros                                                        */
/*****************************************************************************/
typedef enum
{
    //For Message Status Type.
    LOG_LEVEL_DEBUG = 1,
    LOG_LEVEL_INFO,
    LOG_LEVEL_NORMAL,
    LOG_LEVEL_IMPORTANT,
    LOG_LEVEL_WARNING,
    LOG_LEVEL_ERROR
}
LOG_LEVEL;

/*
#ifndef TRC_LEVEL
#if TARGET_IPHONE_SIMULATOR != 0
#define BASE_LEVEL 0
#else
#define BASE_LEVEL 5
#endif
#endif*/

#define LOG_INFO_STR @"Info:"
#define LOG_DEBUG_STR @"Debug:"
#define LOG_NORMAL_STR @"Normal:"
#define LOG_IMPORTANT_STR @"Important:"
#define LOG_WARNING_STR @"Warning:"
#define LOG_ERROR_STR @"Error:"

#define LogInf(...) LogTo(LOG_LEVEL_INFO, __FUNCTION__,__LINE__,__VA_ARGS__)
#define LogDbg(...) LogTo(LOG_LEVEL_DEBUG, __FUNCTION__,__LINE__,__VA_ARGS__)
#define LogNor(...) LogTo(LOG_LEVEL_NORMAL, __FUNCTION__,__LINE__,__VA_ARGS__)
#define LogImp(...) LogTo(LOG_LEVEL_IMPORTANT, __FUNCTION__,__LINE__,__VA_ARGS__)
#define LogWar(...) LogTo(LOG_LEVEL_WARNING, __FUNCTION__,__LINE__,__VA_ARGS__)
#define LogErr(...) LogTo(LOG_LEVEL_ERROR, __FUNCTION__,__LINE__,__VA_ARGS__)


#define LogExit(...) LogExitGo(__FUNCTION__,__LINE__,__VA_ARGS__)

void LogTo(LOG_LEVEL level,const char * func,size_t line,NSString * format,...);
void LogExitGo(const char * func,size_t line,NSString * format,...);
/*

#if (TRC_LEVEL <= 1)
#define TRC_DBG(A, ...) NSLog(@"DEBUG: %s:%d:%@", __PRETTY_FUNCTION__,__LINE__,[NSString stringWithFormat:A, ## __VA_ARGS__]);
#else
#define TRC_DBG(A, ...)
#endif

#if (TRC_LEVEL <= 2)
#define TRC_NRM(A, ...) NSLog(@"NORMAL:%s:%d:%@", __PRETTY_FUNCTION__,__LINE__,[NSString stringWithFormat:A, ## __VA_ARGS__]);
#else
#define TRC_NRM(A, ...)
#endif

#if (TRC_LEVEL <= 3)
#define TRC_ALT(A, ...) NSLog(@"ALERT: %s:%d:%@", __PRETTY_FUNCTION__,__LINE__,[NSString stringWithFormat:A, ## __VA_ARGS__]);
#else
#define TRC_ALT(A, ...)
#endif

#if (TRC_LEVEL <= 4)
#define TRC_ERR(A, ...) NSLog(@"ERROR: %s:%d:%@", __PRETTY_FUNCTION__,__LINE__,[NSString stringWithFormat:A, ## __VA_ARGS__]);
#else
#define TRC_ERR(A, ...)
#endif

*/

@interface Logger : NSObject

{
    
}
@end
